package com.example.demo.api;

import com.example.demo.model.ApiResult;
import com.example.demo.request.ValidateRequestBody;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author hankChan
 *         2018/2/2 0002.
 */
@RestController
public class ValidateAPIs {

    @RequestMapping(value = "/api/validate",
            method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public ApiResult requestBody(@Validated @RequestBody ValidateRequestBody requestBody) {
        return ApiResult.prepare().success(new Date().getTime());
    }
}
